package com.bwie.patient.service.impl;

import com.bwie.common.security.utils.SecurityUtils;
import com.bwie.patient.domain.po.PatientPrescriptionDTO;
import com.bwie.patient.domain.vo.PrescriptionVo;
import com.bwie.patient.mapper.PatientPrescriptionMapper;
import com.bwie.patient.service.PatientPrescriptionService;
import com.bwie.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatientPrescriptionServiceImpl implements PatientPrescriptionService {
    /**
     * 注入
     */
    @Autowired
    private PatientPrescriptionMapper mapper;

    /**
     * 根据状态和单号查询
     * @param patientPrescriptionDTO
     * @return
     */
    @Override
    public List<PrescriptionVo> getList(PatientPrescriptionDTO patientPrescriptionDTO) {
        //获得登录用户id
        LoginUser loginUser = SecurityUtils.getLoginUser();
        //赋值
        patientPrescriptionDTO.setPatientId(loginUser.getUserid());
        //根据单号状态查询处方列表
        List<PrescriptionVo> list = mapper.getList(patientPrescriptionDTO);
        //返回
        return list;
    }
}
